package com.mt.utils;

import cn.hutool.core.collection.CollUtil;
import com.mt.pojo.CinemaSeat;

import java.util.List;

/**
 * @author Wang
 * @Description 订单分布式锁Key生成类
 * @date 2021/1/1-20:00
 */
public class orderLockKeyGenerator {
    public static List<String> getKey(int scheduleId, List<CinemaSeat> seatIds){
        List<String> keys = CollUtil.newArrayList();
        for (CinemaSeat i : seatIds){
            StringBuilder builder = new StringBuilder();
            builder.append(scheduleId);
            builder.append("::");
            builder.append(i.getId());
            keys.add(builder.toString());
        }
        return keys;
    }
}
